import React from 'react';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import { WingBlank, WhiteSpace, List } from 'antd-mobile';

const ArchivesPage = ({ dispatch, location, ...rest }) => {

  const archives = [{
    label: '舌镜记录',
    pathname: 'tongue',
    thumb: require('assets/icons/icon-doc-tongue.svg'),
  }, {
    label: '问诊单记录',
    pathname: 'inquiry',
    thumb: require('assets/icons/icon-doc-inquiry.svg'),
  }, {
    label: '体检报告',
    pathname: 'report',
    thumb: require('assets/icons/icon-doc-checkup.svg'),
  }];

  return (
    <WingBlank size="md">
      <WhiteSpace />
      <List className="health-archive-list">
        {archives.map((archive, i) =>
          <List.Item
            key={i}
            arrow="horizontal"
            thumb={archive.thumb}
            onClick={() => dispatch(routerRedux.push({
              pathname: `${location.pathname}/${archive.pathname}`,
              state: { title: archive.label},
            }))}>
            {archive.label}
          </List.Item>
        )}
      </List>
    </WingBlank>
  );
};

export default connect()(ArchivesPage);
